home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / CUGUK / COMMS / C101.ZIP / UUPC11XS.ZIP / UUCICO / DCP.H < prev    next >
C/C++ Source or Header  |  1992-11-12  |  6KB  |  126 lines

  1. #ifndef __DCP
  2. #define __DCP
  3. /*
  4.  *      History:77,17
  5.  *      Mon May 15 19:54:43 1989 change portactive to port_active
  6.  *      Mon May 15 19:51:13 1989 Add portactive flag
  7.  *      19 Mar 1990  Add hostable.h header                           ahd
  8.  *
  9.  */
  10.  
  11. /*
  12.         For best results in visual layout while viewing this file, set
  13.         tab stops to every 4 columns.
  14. */
  15.  
  16. /*
  17.         dcp.h
  18. */
  19.  
  20. /* DCP a uucp clone. Copyright Richard H. Lamb 1985,1986,1987 */
  21.  
  22. #define MAXPACK 512           /* Max packet size we can handle       */
  23. #define SMALL_PACKET 64       /* Max packet size most UUCP's can
  24.                                  handle                              */
  25. #ifndef RECV_BUF
  26. #define RECV_BUF 4096         /* COMMFIFO Buffer size                */
  27. #endif
  28.  
  29. #define ERROR   10
  30. #define EMPTY   11
  31.  
  32. /*--------------------------------------------------------------------*/
  33. /*    Define high level state machine levels.  These levels define    */
  34. /*    processing during initialization, connection and                */
  35. /*    termination, but not during actual file transfers               */
  36. /*--------------------------------------------------------------------*/
  37.  
  38. typedef enum {
  39.       CONN_INITSTAT   = 'A',  /* Load host status file               */
  40.       CONN_INITIALIZE,        /* Select system to call, if any       */
  41.       CONN_CALLUP1,           /* Dial out to another system          */
  42.       CONN_CALLUP2,           /* Dial out to another system          */
  43.       CONN_HOTMODEM,          /* Initialize for a modem already
  44.                                  off-hook                            */
  45.       CONN_ANSWER,            /* Wait for phone to ring and user to
  46.                                  login                               */
  47.       CONN_LOGIN,             /* Modem is connected, do a login      */
  48.       CONN_HOTLOGIN,          /* Modem is connected, initialize user
  49.                                  from command line w/o login         */
  50.       CONN_PROTOCOL,          /* Exchange protocol information       */
  51.       CONN_SERVER,            /* Process files after dialing out     */
  52.       CONN_CLIENT,            /* Process files after being called    */
  53.       CONN_TERMINATE,         /* Terminate procotol                  */
  54.       CONN_DROPLINE,          /* Hangup the telephone                */
  55.       CONN_EXIT }             /* Exit state machine loop             */
  56.       CONN_STATE ;
  57.  
  58. /*--------------------------------------------------------------------*/
  59. /*                        File transfer states                        */
  60. /*--------------------------------------------------------------------*/
  61.  
  62. typedef enum {
  63.       XFER_SENDINIT = 'a',    /* Initialize outgoing protocol        */
  64.       XFER_MASTER,            /* Begin master mode                   */
  65.       XFER_FILEDONE,          /* Receive or transmit is complete     */
  66.       XFER_NEXTJOB,           /* Look for work in local queue        */
  67.       XFER_REQUEST,           /* Process work in local queue         */
  68.       XFER_PUTFILE,           /* Send a file to remote host at our
  69.                                  request                             */
  70.       XFER_GETFILE,           /* Retrieve a file from a remote host
  71.                                  at our request                      */
  72.       XFER_SENDDATA,          /* Remote accepted our work, send data */
  73.       XFER_SENDEOF,           /* File xfer complete, send EOF        */
  74.       XFER_NOLOCAL,           /* No local work, remote have any?     */
  75.       XFER_SLAVE,             /* Begin slave mode                    */
  76.       XFER_RECVINIT,          /* Initialize Receive protocol         */
  77.       XFER_RECVHDR,           /* Receive header from other host      */
  78.       XFER_GIVEFILE,          /* Send a file to remote host at their
  79.                                  request                             */
  80.       XFER_TAKEFILE,          /* Retrieve a file from a remote host
  81.                                  at their request                    */
  82.       XFER_RECVDATA,          /* Receive file data from other host   */
  83.       XFER_RECVEOF,           /* Close file received from other host */
  84.       XFER_NOREMOTE,          /* No remote work, local have any?     */
  85.       XFER_LOST,              /* Lost the other host, flame out      */
  86.       XFER_ABORT,             /* Internal error, flame out           */
  87.       XFER_ENDP,              /* End the protocol                    */
  88.       XFER_EXIT               /* Return to caller                    */
  89.       } XFER_STATE ;
  90.  
  91. #define RETRY   (-2)
  92. #define FAILED  (-1)
  93. #define OK              0
  94.  
  95. typedef int     (*procref)();
  96.  
  97. typedef struct {
  98.         char type;
  99.         procref getpkt, sendpkt, openpk, closepk, rdmsg, wrmsg, eofpkt,
  100.                   filepkt;
  101. } Proto;
  102.  
  103.  
  104. extern size_t pktsize;             /* packet size for this protocol*/
  105. extern FILE *syslog;            /* syslog file pointer                  */
  106. extern char workfile[FILENAME_MAX];
  107.                                 /* name of current workfile             */
  108. extern FILE *fwork;             /* current work file pointer    */
  109. extern FILE *xfer_stream;       /* current disk file stream for file
  110.                                    being transfered                     */
  111. extern FILE *fsys;
  112.  
  113. extern char *Rmtname;           /* system we WANT to talk to    */
  114.  
  115. extern char rmtname[20];        /* system we end up talking to  */
  116.  
  117. extern char s_systems[FILENAME_MAX];
  118.                                 /* full-name of systems file    */
  119. extern struct HostTable *hostp;
  120. extern struct HostStats remote_stats;
  121.                                  /* host status, as defined by hostatus */
  122.  
  123. int    dcpmain(int  argc,char  * *argv);
  124.  
  125. #endif /* __DCP */
  126.